<?php

/**
 * Varinv form base class.
 *
 * @method Varinv getObject() Returns the current form's model object
 *
 * @package    seth
 * @subpackage form
 * @author     Fuz
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseVarinvForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'         => new sfWidgetFormInputHidden(),
      'dev'        => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Powerdev'), 'add_empty' => false)),
      'sampletime' => new sfWidgetFormDateTime(),
      'source'     => new sfWidgetFormInputText(),
      'sourceid'   => new sfWidgetFormInputText(),
      'proden'     => new sfWidgetFormInputText(),
      'pac'        => new sfWidgetFormInputText(),
      'vac'        => new sfWidgetFormInputText(),
      'iac'        => new sfWidgetFormInputText(),
      'vac12'      => new sfWidgetFormInputText(),
      'vac23'      => new sfWidgetFormInputText(),
      'vac13'      => new sfWidgetFormInputText(),
      'iac1'       => new sfWidgetFormInputText(),
      'iac2'       => new sfWidgetFormInputText(),
      'iac3'       => new sfWidgetFormInputText(),
      'f'          => new sfWidgetFormInputText(),
      'state'      => new sfWidgetFormInputText(),
      'vdc1'       => new sfWidgetFormInputText(),
      'idc1'       => new sfWidgetFormInputText(),
      'vdc2'       => new sfWidgetFormInputText(),
      'idc2'       => new sfWidgetFormInputText(),
      'vdc3'       => new sfWidgetFormInputText(),
      'idc3'       => new sfWidgetFormInputText(),
      'vdc4'       => new sfWidgetFormInputText(),
      'idc4'       => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'id'         => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'dev'        => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Powerdev'))),
      'sampletime' => new sfValidatorDateTime(),
      'source'     => new sfValidatorString(array('max_length' => 255)),
      'sourceid'   => new sfValidatorInteger(),
      'proden'     => new sfValidatorNumber(array('required' => false)),
      'pac'        => new sfValidatorNumber(array('required' => false)),
      'vac'        => new sfValidatorNumber(array('required' => false)),
      'iac'        => new sfValidatorNumber(array('required' => false)),
      'vac12'      => new sfValidatorNumber(array('required' => false)),
      'vac23'      => new sfValidatorNumber(array('required' => false)),
      'vac13'      => new sfValidatorNumber(array('required' => false)),
      'iac1'       => new sfValidatorNumber(array('required' => false)),
      'iac2'       => new sfValidatorNumber(array('required' => false)),
      'iac3'       => new sfValidatorNumber(array('required' => false)),
      'f'          => new sfValidatorNumber(array('required' => false)),
      'state'      => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'vdc1'       => new sfValidatorNumber(array('required' => false)),
      'idc1'       => new sfValidatorNumber(array('required' => false)),
      'vdc2'       => new sfValidatorNumber(array('required' => false)),
      'idc2'       => new sfValidatorNumber(array('required' => false)),
      'vdc3'       => new sfValidatorNumber(array('required' => false)),
      'idc3'       => new sfValidatorNumber(array('required' => false)),
      'vdc4'       => new sfValidatorNumber(array('required' => false)),
      'idc4'       => new sfValidatorNumber(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('varinv[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Varinv';
  }

}
